package com.store.app.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.store.app.R;
import com.store.app.bean.BankInfo;

import java.util.List;

/**
 * Created by Administrator on 2016/11/1.
 */

public class BankListAdapter extends BaseAdapter {
    private List<BankInfo> list;
    private Context context;

    public BankListAdapter(Context context, List<BankInfo> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {

        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        BankListAdapter.ViewHolder viewHolder = null;
        if (convertView == null) {
            viewHolder = new BankListAdapter.ViewHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.item_bank, null);
            viewHolder.tvBankName = (TextView) convertView.findViewById(R.id.tv_bankname);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (BankListAdapter.ViewHolder) convertView.getTag();
        }
        viewHolder.tvBankName.setText(list.get(position).getBank_name());
        viewHolder.tvBankName.setText(list.get(position).getBank_name());
        return convertView;
    }


    class ViewHolder {
        TextView tvBankName;
    }
}
